﻿using DBUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Text;

namespace ConsoleSqlLite
{
    class Program
    {
        static void Main(string[] args)
        {
            //使用示例 SQLite  
            string connectionString = @"Data Source=D:\VS2008\NetworkTime\CrawlApplication\CrawlApplication.db3";
            string sql = "SELECT * FROM Weibo_Media order by Id desc limit 0,20000";
            DbUtility db = new DbUtility(connectionString, DbProviderType.SQLite);
            DataTable data = db.ExecuteDataTable(sql, null);
            DbDataReader reader = db.ExecuteReader(sql, null);
            reader.Close();
            //使用示例 MySql  
            connectionString = @"Server=localhost;Database=crawldb;Uid=root;Pwd=root;Port=3306;";
            sql = "SELECT * FROM Weibo_Media order by Id desc limit 0,20000";
            db = new DbUtility(connectionString, DbProviderType.MySql);
            data = db.ExecuteDataTable(sql, null);
            reader = db.ExecuteReader(sql, null);
            reader.Close();
            //使用示例 Execl  
            //connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/XLS/车型.xls") + ";Extended Properties=Excel 8.0;";
            //sql = "SELECT * FROM [Sheet1$]";
            //db = new DbUtility(connectionString, DbProviderType.OleDb);
            //data = db.ExecuteDataTable(sql, null);
        }
    }
}
